﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace br.com.SistemaChamados.QueryManager.Core
{
    public class QueryManagerConstants
    {
        public static string EXPRESSION_TABLE_NAME = "$TABLE_NAME$";
        public static string EXPRESSION_IDENTIFIER_FIELD = "$IDENTIFIER_FIELD$";
        public static string EXPRESSION_VALUE_FIELD = "$VALUE_FIELD$";
        public static string EXPRESSION_SET_FIELDS = "$SET_FIELDS";
        public static string EXPRESSION_CONDITIONS_UPDATE_DELETE = "$CONDITIONS_UPDATE$";
        public static string EXPRESSION_FIELDS_INSERT = "$FIELDS_INSERT$";
        public static string EXPRESSION_VALUES_INSERT = "$VALUES_INSERT$";

        public static string PREFIX_TABLE = "TBL_";
        public static string PREFIX_FIELD = "TBL_";
        public static string TEMPLATE_SQL_SELECT = "SELECT * FROM " + EXPRESSION_TABLE_NAME;
        public static string TEMPLATE_SQL_SELECT_IDENTIFIER = "SELECT * FROM " + EXPRESSION_TABLE_NAME + " WHERE " + EXPRESSION_IDENTIFIER_FIELD + " = " + EXPRESSION_VALUE_FIELD;
        public static string TEMPLATE_SQL_UPDATE = "UPDATE " + EXPRESSION_TABLE_NAME + " SET " + EXPRESSION_SET_FIELDS + " WHERE " + EXPRESSION_CONDITIONS_UPDATE_DELETE;
        public static string TEMPLATE_SQL_DELETE = "DELETE FROM " + EXPRESSION_TABLE_NAME + " WHERE " + EXPRESSION_CONDITIONS_UPDATE_DELETE;
        public static string TEMPLATE_SQL_INSERT = "INSERT INTO " + EXPRESSION_TABLE_NAME + " ("+EXPRESSION_FIELDS_INSERT+") VALUES (" + EXPRESSION_VALUES_INSERT + ")";

        public const string INTEGER_PARSE = "System.Int32";
        public const string STRING_PARSE = "System.String";
        public const string DOUBLE_PARSE = "System.Double";
        public const string DECIMAL_PARSE = "System.Decimal";
        public const string BOOLEAN_PARSE = "System.Boolean";
        public const string DATETIME_PARSE = "System.DateTime";

        public static string[] PARSEABLE_TYPES = new string[] { INTEGER_PARSE, STRING_PARSE, DOUBLE_PARSE, DECIMAL_PARSE, 
                                                                      BOOLEAN_PARSE, DATETIME_PARSE};

        public static string IDENTIFIER_PROPERTY_NAME = "Id";
    }
}